package org.esgi.user.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import org.esgi.user.model.collection.UserCollection;
import org.esgi.user.model.interfaces.IDao;

public class JobDao extends ConnectionMysql implements IDao{

	private ConnectionMysql _connection = null;
	
	public JobDao() {
		super();
//		_connection = ConnectionMysql.getInstance();
	}
	

	/**
	 * Return the associated User for the given id.
	 * 
	 * @param userId
	 * @return
	 * @throws SQLException
	 */

	public ArrayList<String> selectAll() throws SQLException {
		if (null == selectById)
			selectById = this.getConnection().prepareStatement("SELECT * FROM job ");
//		selectById.setInt(1, 1);
		ResultSet result = selectById.executeQuery();
		ArrayList<String> jobs = new ArrayList<String>();

		int i = 0;
		while (result.next()) {
			jobs.add(i, result.getString("name"));
			i++;
		}
		return jobs;
	}

	@Override
	public boolean insert(UserCollection user) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public UserCollection select(Integer userId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public UserCollection selectByColumn(String column, Object value) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void reset() {
		// TODO Auto-generated method stub
		
	}
}
